Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@remote-ui/rpc

Package Overview
Dependencies
Maintainers
3
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remote-ui/rpc

An RPC library with strong support for simulating the transfer of functions via postMessage

  • 1.4.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
159K
decreased by-2.3%
Maintainers
3
Weekly downloads
 
Created

What is @remote-ui/rpc?

@remote-ui/rpc is a package that facilitates remote procedure calls (RPC) between different contexts, such as between a web worker and the main thread. It allows for seamless communication and function invocation across these boundaries, making it easier to build modular and decoupled applications.

What are @remote-ui/rpc's main functionalities?

Creating an RPC endpoint

This feature allows you to create an RPC endpoint. The `createEndpoint` function is used to set up an endpoint in a given context, such as a web worker.

const {createEndpoint} = require('@remote-ui/rpc');

const endpoint = createEndpoint(self);

Defining callable functions

This feature allows you to define functions that can be called remotely. The `expose` function is used to make these functions available to the other context.

const {expose} = require('@remote-ui/rpc');

function add(a, b) {
  return a + b;
}

expose({add});

Calling remote functions

This feature allows you to call functions that are defined in another context. The `createRemote` function is used to create a remote object that can call the exposed functions.

const {createEndpoint, createRemote} = require('@remote-ui/rpc');

const endpoint = createEndpoint(self);
const remote = createRemote(endpoint);

async function performAddition() {
  const result = await remote.call.add(1, 2);
  console.log(result); // 3
}

performAddition();

Other packages similar to @remote-ui/rpc

FAQs

Package last updated on 12 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc